package com.javasm.transfer;

import com.javasm.domin.entity.AftersaleB2cChange;
import com.javasm.domin.vo.AftersaleB2cChangeVo;
import com.javasm.mapper.AdminMapper;
import com.javasm.transfer.base.BaseTransfer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

import static com.javasm.common.dictionary.AfterinitContext.afdic;

@Component
@RequiredArgsConstructor
public class AftersaleB2cChangeTransfer extends BaseTransfer<AftersaleB2cChange, AftersaleB2cChangeVo> {
    private final AdminMapper adminMapper;

    public List<AftersaleB2cChangeVo> jotoVo(List<AftersaleB2cChange> aftersaleB2cChanges){
        List<AftersaleB2cChangeVo> aftersaleB2cChangeVos = super.toVO(aftersaleB2cChanges);
        for (int i = 0; i < aftersaleB2cChangeVos.size(); i++) {
            AftersaleB2cChange aftersaleB2cChange = aftersaleB2cChanges.get(i);
            AftersaleB2cChangeVo aftersaleB2cChangeVo = aftersaleB2cChangeVos.get(i);
            if (aftersaleB2cChange.getRetreatType()!=null&&aftersaleB2cChange.getRetreatType()!=0){
                aftersaleB2cChangeVo.setRetreatTypename(afdic.get(6).get(aftersaleB2cChange.getRetreatType()));
            }
            if (aftersaleB2cChange.getStockState()!=null&&aftersaleB2cChange.getStockState()!=0){
                aftersaleB2cChangeVo.setStockStatename(afdic.get(4).get(aftersaleB2cChange.getStockState()));
            }
            if (aftersaleB2cChange.getBatchState()!=null&&aftersaleB2cChange.getBatchState()!=0){
                aftersaleB2cChangeVo.setBatchStatename(afdic.get(2).get(aftersaleB2cChange.getBatchState()));
            }
            if (aftersaleB2cChange.getNumberState()!=null&&aftersaleB2cChange.getNumberState()!=0){
                aftersaleB2cChangeVo.setNumberStatename(afdic.get(3).get(aftersaleB2cChange.getNumberState()));
            }
        }
        return aftersaleB2cChangeVos;
    }
}
